' Provides easy and central access to user configuration settings.
Friend NotInheritable Class SettingsWrapper
    Private Shared _settings As Settings

    ' Load settings.
    Shared Sub New()
        _settings = New Settings()
    End Sub

    ' Prevent direct instantiation.
    Private Sub New()
    End Sub


    Public Shared Property CacheFolder() As String
        Get
            Return _settings.CacheFolder
        End Get
        Set(ByVal value As String)
            If value Is Nothing Then
                Throw New ArgumentNullException("value")
            End If
            _settings.CacheFolder = value
            _settings.Save()
        End Set
    End Property

    Public Shared Property ShareFolder() As String
        Get
            Return _settings.ShareFolder
        End Get
        Set(ByVal value As String)
            If value Is Nothing Then
                Throw New ArgumentNullException("value")
            End If
            _settings.ShareFolder = value
            _settings.Save()
        End Set
    End Property

    Public Shared Property P2PAddress() As String
        Get
            Return _settings.P2PAddress
        End Get
        Set(ByVal value As String)
            If value Is Nothing Then
                Throw New ArgumentNullException("value")
            End If
            _settings.P2PAddress = value
            _settings.Save()
        End Set
    End Property

    Public Shared Property P2PPassword() As String
        Get
            Return _settings.P2PPassword
        End Get
        Set(ByVal value As String)
            If value Is Nothing Then
                Throw New ArgumentNullException("value")
            End If
            _settings.P2PPassword = value
            _settings.Save()
        End Set
    End Property

    Public Shared Property MaxPictureSize() As UInteger
        Get
            Return _settings.MaxPictureSize
        End Get
        Set(ByVal value As UInteger)
            _settings.MaxPictureSize = value
            _settings.Save()
        End Set
    End Property

End Class

